package main.demonutils;

public class IslandTime{
	private final int HOUR = 60;
	private final int DAY = 60*24;
	private final int WEEK = 60*24*7;
	private final int YEAR = 60*24*7*52;

	private int time;

	public IslandTime(int time){
		this.time = time;
	}

	public int getMinutes(){return time;}
	public int getHours(){return time/HOUR;}
	public int getDays(){return time/DAY;}
	public int getWeeks(){return time/WEEK;}
	public int getYears(){return time/YEAR;}

	public void addMinutes(int minutes){time = time + minutes;}
	public void addHours(int hours){time = time + hours*HOUR;}
	public void addWeeks(int weeks){time = time + weeks*WEEK;}
	public void addYears(int years){time = time + years*YEAR;}

	public int getWeeksRound(){
		int remainder = time;
		if(time>YEAR){remainder = remainder - getYears();}
		return remainder;
	}

	public int getDaysRound(){
		int remainder = time;
		if(time>WEEK){remainder = remainder - getWeeks();}
		return remainder;
	}

	public int getHoursRound(){
		int remainder = time;
		if(time>DAY){remainder = remainder - getDays();}
		return remainder;
	}

	public int getMinutesRound(){
		int remainder = time;
		if(time>HOUR){remainder = remainder - getHours();}
		return remainder;
	}
}
